//
//  RecommendView.m
//  JZMCFM
//
//  Created by zhangxin.com on 15/11/2.
//  Copyright (c) 2015年 陈卓. All rights reserved.
//

#import "RecommendView.h"

@implementation RecommendView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [[RecommedHelper shareInstance]downLoadFinished:^{
            [self.RecommendTableView reloadData];
        }];
        
        [self setTable];
    
        
    }
    return self;
}

- (void)setTable
{
    self.RecommendTableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:UITableViewStyleGrouped];
   // [self addHeaderView];
    [self addSubview:self.RecommendTableView];
    
}
- (void)addHeaderView
{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kscreenwidth, 180)];
    NSMutableArray *imageArray = [NSMutableArray array];
    
    for (int i = 0; i < [RecommedHelper shareInstance].RecommedDataArray.count; i++) {
        NSLog(@"%ld",[RecommedHelper shareInstance].RecommedDataArray.count);
        RecommedModel *model = [RecommedHelper shareInstance].RecommedDataArray[i];
        NSLog(@"%@",model);
        [imageArray addObject:model.pic];
    }
    
    SDCycleScrollView * cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kscreenwidth, 180) imageURLStringsGroup:imageArray];
    cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolAlimentRight;
    cycleScrollView.autoScrollTimeInterval =3;
    cycleScrollView.dotColor = [UIColor grayColor];
    [view addSubview:cycleScrollView];
    self.RecommendTableView.tableHeaderView = view;
    
    
    
}

@end
